package cbbx_sm.utils;

import java.util.Comparator;

import org.jgrapht.WeightedGraph;
import org.jgrapht.graph.DefaultWeightedEdge;

@SuppressWarnings("unchecked")
public class DefaultWeightedEdgeComparator implements Comparator<DefaultWeightedEdge> {
	WeightedGraph g;
	public DefaultWeightedEdgeComparator(WeightedGraph g){
		this.g = g;
	}
	
	@Override
	public int compare(DefaultWeightedEdge o1, DefaultWeightedEdge o2) {
		if (g.getEdgeWeight(o1) > g.getEdgeWeight(o2)) return 1;
		if (g.getEdgeWeight(o1) < g.getEdgeWeight(o2)) return -1;
		return 0;
	}
}
